<template>
  <div>
    <el-tabs v-model="activeName" class="demo-tabs">
      <el-tab-pane label="喵灵Profile设定" name="first">
        <miao :data="profileData" />
      </el-tab-pane>
      <el-tab-pane label="产品知识设定" name="second">
        <prod :data="prodData" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import miao from "@/views/RAG/miao.vue";
import prod from "@/views/RAG/prod.vue";
import { globalData } from "@/apis/global";
import { ElMessage } from "element-plus";

const activeName = ref("first");
const profileData = ref({});
const prodData = ref({});

onMounted(() => {
  getData();
});

const getData = async () => {
  try {
    let res = await globalData();
    console.log(res);
    if (res.data.code == 200) {
      profileData.value.npc_prf_bas = res.data.data.npc_prf_bas;
      profileData.value.npc_prf_char = res.data.data.npc_prf_char;
      profileData.value.npc_prf_outfit = res.data.data.npc_prf_outfit;
      profileData.value.npc_prf_bg = res.data.data.npc_prf_bg;
      profileData.value.npc_prf_selfintro = res.data.data.npc_prf_selfintro;
      profileData.value.npc_prf_port = res.data.data.npc_prf_port;
      prodData.value.pd_info_aitech = res.data.data.pd_info_aitech;
      prodData.value.pd_info_bas = res.data.data.pd_info_bas;
      prodData.value.pd_info_brand = res.data.data.pd_info_brand;
      prodData.value.pd_info_coorp = res.data.data.pd_info_coorp;
      prodData.value.pd_info_error = res.data.data.pd_info_error;
      prodData.value.pd_info_opr = res.data.data.pd_info_opr;
      prodData.value.pd_info_priv = res.data.data.pd_info_priv;
    } else {
      ElMessage.error(res.data.message);
    }
  } catch (e) {
    console.log(e);
  }
};
</script>

<style lang="scss" scoped></style>
